// pages/feedback/feedback.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    content: null
  },

  submit: function () {
    let token = wx.getStorageSync('token')
    let host = app.globalData.host
    let content = this.data.content
    wx.request({
      url: host + '/feedback',
      method: 'POST',
      header: {
        'authorization': token,
        'content-type': 'application/x-www-form-urlencoded'
      },
      data: {
        content: content
      },
      success: (res) => {
        if(res.data.data == 1){
          wx.showToast({title: '提交成功,感谢您的反馈'})
        }else{
          wx.showToast({ title: '提交失败', icon: 'none' })
        }
      },
      fail: (e) => {
        console.log(e)
      }
    })
  },

  changeData: function (e) {
    let name = e.currentTarget.dataset.name;
    console.log("改变后的值" + e.detail.value)
    this.setData({
      [name]: e.detail.value
    })
  }
})